package iodemo;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;

public class FileUtilsssss
{
    public static void main (String[] args) throws IOException
    {
        FileUtils.copyDirectory(new File("d:/NewFiles"), new File("d:/NewFile"), new FileFilter()
        {
            //定义文件拷贝规则
            @Override
            public boolean accept (File pathname)
            {
                if(pathname.isDirectory() | pathname.getName().endsWith("txt"))
                    return true;
                
                return false;
            }
        });
    }
}
